<script>
  jQuery(document).ready(function() {
    jQuery('#city_id').change(function(){  
                                // alert(jQuery(this).val());
                                id = jQuery(this).val();
                                
                                if(id != "")
                                {
                                  loading_area('<%= image_tag "loading_ajax.gif" %>', "#areas_contents", "#areas_contents");
                                  jQuery.ajax({
                                  url: '<%= url_for({:controller => 'areas', :action => 'areas_by_city'}) %>',
                                  data: "cityid="+id,
                                  success: function (data){
                                        jQuery('#areas_contents').html(data)
                                      }
                                }); 
                                }
                        });
  });
</script>


<%= form_for(@event, :url => {:action => 'save', :id => @event.id}) do |f| %>
  <% if @event.errors.any? %>
	  <div class="notification errors closable">
		<h3><%= pluralize(@event.errors.count, "error") %> prohibited this article from being saved:</h3>
		<ul>
			<% @event.errors.full_messages.each do |msg| %>				
				<li><%= msg %></li>
			<% end %>			
		</ul>
	<span title="Close" class="closelink"></span></div>      
  <% end %>	
                        
					<form method="post" action="">
					  
					  <fieldset>
						<legend>Details</legend>
						<h4>Please fill in the form.</h4>
						
						<%= f.label :title %><%= f.text_field :title, :class => "medium" %>
						<p class="validation">
						*required</p>
						
						<%= f.label :alias %><%= f.text_field :alias, :class => "medium" %>
						
						<%= f.label :description %><%= f.text_area :description, :rows => '10', :style => 'width: 500px' %>
						<p class="validation">
						*required						
						</p>
						
						<%= f.label :City %>
						<%= select("city", "id", @cities) %>
						
						<%= f.label :Area %>
						<div id="areas_contents">
						  <%= select("location", "area_id", @areas) %>
						</div>
						
						<!-- tinyMCE.execInstanceCommand("article_body","mceInsertContent",false,"sdfsdf"); -->
						
					</fieldset>
					  
					
					</form>
				
<% end %>
